<template>
  <van-swipe-cell style="border: 1px">
    <div style="display: flex">
      <van-checkbox v-model="item.check"></van-checkbox>
      <van-card style="flex: 1" :price="item.price.toFixed(2)" :desc="item.desc" :title="item.title" :thumb="item.thumb">
        <template #num>
          <van-stepper v-model="item.num" theme="round" button-size="22" disable-input />
        </template>
      </van-card>
    </div>
    <template #right>
      <van-button square text="删除" type="danger" @click="cart.delIndex(index)" style="height: 100%" />
    </template>
  </van-swipe-cell>
</template>

<script lang="ts" setup>
import { type ICart } from '@/stores/cart';
import { useCartStore } from '../stores/cart';

defineProps<{ item: ICart; index: number }>();

const cart = useCartStore();
</script>

<style lang="scss" scoped></style>
